      SUBROUTINE PULSUN
C
      IMPLICIT REAL*8(A-H,O-Z)
C
      COMMON/CONSTS/PI,TWOPI,RAD
C
      COMMON/CSTVAL/TSTART,DUM5(40)
C
      COMMON/ITCNTL/IPULSE,ISPLSE,KPULSE,ITSW,IOTSW,IPLPRP
C
      COMMON/OUTTHR/SMAGB(3)
C
      COMMON/RPOOL1/DUM2(10),TIME,SA(3,3),DUM3(19),OMEG(3),DUM4(83)
C
      COMMON/RMGNTC/SMAGI(3)
C
      COMMON/SENVTR/DIY(3),DL2
C
      COMMON/THRUST/TV(3,2),TLOC(3,2),TTIM(4,2),TPAR(4,2),REF(2)
C
      COMMON/TIMPLS/TMEAN(2),TPULSE(2),TOPLSE(2),TTSTOP(2),DELV(2)
C
C
C
      WS2=DIY(2)
      WS1=DIY(1)
      IF(TIME.GT.TSTART) GO TO 10
      TLAST=TIME
      DL2=WS2
   10 CONTINUE
C
      WS3=WS1*WS1+WS2*WS2
      WS3=DSQRT(WS3)
      IF(WS3.GT.0.01745D0) GO TO 20
      WS3=WS3/RAD
      WRITE(6,1000) WS3
 1000 FORMAT('0',5X,'THE ANGLE BETWEEN THE SUN VECTOR AND THE SPIN
     1      AXIS IS',1PE15.5,'DEG.')
      CALL EXIT
C
   20 CONTINUE
      IF(TIME.LE.TLAST) GO TO 100
      IF(ITSW.EQ.0) GO TO 90
      IF(WS2.LE.0.0D0) GO TO 90
      IF(DL2.GT.0.0D0) GO TO 90
      TDIF=TIME-TLAST
      CDEN=WS2-DL2
      TCROSS=TIME-TDIF*WS2/CDEN
C
      DO 30 I=1,IPLPRP
      TDIF=REF(I)*RAD/OMEG(3)
      TDIF=DABS(TDIF)
      TPULSE(I)=TCROSS+TDIF
      TOPLSE(I)=TPULSE(I)+TMEAN(I)
      TTSTOP(I)=TPULSE(I)+TTIM(4,I)-TTIM(1,I)
   30 CONTINUE
C
      ITSW=0
C
   90 CONTINUE
C
      TLAST=TIME
      DL2=WS2
C
  100 CONTINUE
C
      RETURN
C
      END
